<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>签到</title>
    <script src="/js/plugins/jquery/jquery.min.js"></script>
    <link rel="stylesheet" href="/css2/bootstrap3/css/bootstrap.min.css">
    <link rel="stylesheet" href="/css2/font/css/font-awesome.min.css"/>
    <script src="/js/plugins/bootstrap-4.1.1-dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css2/style.css">
    <link rel="stylesheet" href="/css2/qiandao_style.css">
    <script src="/js/common.js"></script>
    <link rel="stylesheet" href="/js/plugins/jquery-confirm/css/jquery-confirm.css">
    <script src="/js/plugins/jquery-confirm/js/jquery-confirm.js"></script>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css"/>
    <script src="/js/plugins/dialog2/dialog.min.js"></script>

    <script>
        $(function () {

            function signIn() {
                $(".maskbox").fadeIn();
                $(".qdbox").fadeIn();
                $(".maskbox").height($(document).height());
            }

            $(".maskbox").click(function () {
                $(".maskbox").fadeOut();
                $(".qdbox").fadeOut();
                window.location.reload();
            });

            var Params = getParams();
            if (Params.id) {
                //点击签到按钮
                $('.btn-qiandao').click(function () {
                    $.ajax({
                        url: "/sign",
                        type: "post",
                        id: Params.id,
                        success: function (data) {
                            if (data.success) {
                                signIn();
                            } else {
                                $(document).dialog({
                                    type: 'confirm',
                                    style: 'ISO',
                                    titleShow: false,
                                    content: '今天已经签到了哦',
                                    buttons: [
                                        {
                                            name: '确认',
                                            callback: function () {
                                            }
                                        }
                                    ]
                                });
                            }
                        }
					})
                });
               	//获取所有签到的天数
                $.get("/sign/signDetail",{id:Params.id},function (data) {
                    var signList=[];
                    $.each(data,function (index,ele) {
                         var List={
                            "signDay": new Date(ele.creteTime).getDate()
						};
                        signList.push(List);
                    });
					 calUtil.init(signList);
                });

                //查询签到对象信息
		    	$.get("/sign",{id:Params.id},function (data) {
               		$("#signCount").html(data.signCount+1);
                });

                //查询登录对象信息
		    	$.get("/sign/integral",{id:Params.id},function (data) {
               		$("#integral").html(data.integral);
                })

		   		//点击去商城跳转
				$(".goShop").click(function () {
					window.location.href="/store/allGoods.html";
                })
		     };
        })
	</script>
</head>
<body>
<div class="container">
	<div class="nav-search">
		<a href="/mine/profiles.html">
			<span><i class="glyphicon glyphicon-chevron-left font18">返回</i></span>
		</a>
	</div>

	<div class="row">
		<div class="col-xs-12 clearPadding">
			<div class="text-left"><img src="/img/timg.gif" class="img-responsive text-left"></div>
			
			<div class="calendar">
				<div class="calenbox">
					<div id="calendar"></div>
				</div>
				<div class="text-center">
					<button class="btn btn-qiandao" >马上签到</button>
				</div>
			</div>
			<div class="padding10">
				<div class="font16 pb10 borderb"><strong>连续签到礼包</strong></div>
				<div class="libaolist">
					<div class="clearfix borderb ptb10">
						<div class="col-xs-9 clearPadding">
							<div class="media">
								<a class="media-left pt3" href="javascript:void(0);">
									<img src="/img/qiandao.gif" style="width:30px;height:30px;">
								</a>
								<div class="media-body">
									<div class="">3天礼包（额外赠送20积分）</div>
									<div class="text-muted font14">连续签到3天自动领取</div>
									<div class="text-muted font10">温馨提示:签满3天需重新累计</div>
								</div>
							</div>
						</div>
					</div>

						<div class="clearPadding text-right pt2 goShop">
							您的积分为:<span class="text-muted font10 text-left" id="integral"></span>
							<button  class="btn btn-lingqu">去商城换礼品</button>
						</div>
				</div>
			</div>
		</div>
	</div>
</div>
<div class="maskbox"></div>
<div class="qdbox">
	<div class="text-center text-green font18"><strong>签到成功！</strong></div>
	<div class="text-center pt10">您已经连续签到&nbsp;<span class="text-green" id="signCount"></span>&nbsp;天</div>
	<div class="text-center ptb15"><img src="/img/gift.png" style="width:125px;margin-left:20px;"></div>
	<div class="text-center goShop"><button class="btn btn-lottery">去商城换奖品</button></div>
</div>
<script src="/js/calendar.js"></script>
<script>

</script>

</body>
</html>
